<template>
	<div id="content" class="sysDialog ">
		
		<el-dialog :title="pageName" :visible.sync="dialogTableVisible" :before-close="handleClose" width="1000px">

			<!-- 帮助引导 -->
			<guidance class="dialogBtn" title="" :list="helpList"></guidance>
			
			<div class="hei10"></div>
			 <el-tabs v-model="pageType" type="card" @tab-click="handleClick">
				<el-tab-pane label="队列" name="seniorQueue">
					<!-- 队列组件 -->
					<seniorQueue ref="seniorQueueDom" v-show="pageType == 'seniorQueue'"></seniorQueue>
				</el-tab-pane>
				<el-tab-pane label="驱动" name="drive">
					<!-- 驱动组件 -->
					<drive ref="driveDom" v-show="pageType == 'drive'"></drive>
				</el-tab-pane>
				<el-tab-pane label="虚拟IP" name="vip">
					<!-- vip组件 -->
					<vip ref="vipDom" v-show="pageType == 'vip'"></vip>
				</el-tab-pane>
				
				<el-tab-pane label="修复" name="repair">
					<!-- 修复组件 -->
					<repair ref="repairDom" v-show="pageType == 'repair'"></repair>
				</el-tab-pane>
				
			  </el-tabs>
			
	
			 
			 <div class="hei30"></div>
		</el-dialog>

	</div>
</template>

<script>
	
	import seniorQueue from '@/views/console/securityGroup/senior/queue';
	import drive from '@/views/console/securityGroup/senior/drive';
	import vip from '@/views/console/securityGroup/senior/vip';
	import repair from '@/views/console/securityGroup/senior/repair';
	
	export default {
		name: "Senior",
		components: {
			seniorQueue,drive,vip,repair
		},
		data() {
			return {
				helpList:[
					{
						'title':'业务保障高级指引',
						'helpMsg':'业务保障高级',
					},
				
				],
				indexTimeout:'',
				dialogTableVisible:false,
				pageType:'seniorQueue',
				pageName:'队列1',
				item:'',
				itemId:'',
			};
		},
		watch: {

		},
		methods: {
			handleClose:function(){
				this.dialogTableVisible = false
				  this.$nextTick(function () {
					clearInterval(this.$refs.seniorQueueDom.setHandleMonitorTimeout);
					clearInterval(this.$refs.driveDom.setHandleMonitorTimeout);
					clearInterval(this.$refs.repairDom.repairTimeout);
					clearInterval(this.$refs.vipDom.checkVipTime);
					clearInterval(this.indexTimeout);
					
					clearTimeout(this.$refs.repairDom.getIncrementLogTime);
					this.$refs.repairDom.getIncrementLogTime = "";
					this.$refs.repairDom.ywjData.isOpenflag = "";
					this.$refs.repairDom.bzjData.isOpenflag = "";
					this.$refs.repairDom.switchRsyncDirLogData = [];
					//清理上一次的数据，避免污染下一次等待时候的显示 以前的数据
					this.$store.dispatch("clearGroupStatus")
					// console.log(this.$store.getters)
				})
			},
			handleClick:function(){
				
				//清理上一次的数据，避免污染下一次等待时候的显示 以前的数据
				this.$store.dispatch("clearGroupStatus")
				this.getNodeStatusFn();
				
				if(this.pageType == 'seniorQueue'){
					this.pageName = '队列';
					this.$refs.seniorQueueDom.groupId = this.itemId;
					this.$refs.seniorQueueDom.getGroupNodeNioInfoFn(this.item);
				}else if(this.pageType == 'drive'){
					this.pageName = '驱动';
					this.$refs.driveDom.groupId = this.itemId;
					this.$refs.driveDom.groupDriverStatusFn(this.item);
					
				}else if(this.pageType == 'vip'){
					this.pageName = '虚拟IP';
					this.$refs.vipDom.groupId = this.itemId;
					this.$refs.vipDom.groupSecurityServiceInfoFn(this.item);
				}else if(this.pageType == 'repair'){
					this.pageName = '修复';
					this.$refs.repairDom.initData(this.item);
				}	
				
			},
			//获取节点信息
			getNodeStatus(){
				
				if(this.indexTimeout){
					clearInterval(this.indexTimeout)
				}
				this.getNodeStatusFn();
				this.indexTimeout = setInterval(() => {
					this.getNodeStatusFn();
				},5000)
			},
			getNodeStatusFn(){
				this.$store.dispatch("getGroupStatus",this.item).then((res) => {
					// console.log(this.$store.getters.GroupStatus)
				}).catch(() => {
					console.error('获取节点状态接口错误！')
				});
			}	
		}
	}
</script>

<style scoped="scoped">
	.hei30{
		height: 30px;
	}
	.hei10{
		height: 10px;
	}
	.mlBtn{
		position: absolute;
		right: 30px;
		top: 80px;
		z-index: 999;
	}
</style>
